Python How-To by Yong Cui

Python How-To by Yong Cui

Author:Yong Cui [Yong Cui]
Language: eng
Format: epub, pdf
Publisher: Manning Publications Co.
Published: 2023-06-09T22:00:00+00:00


8.5.6 Challenge

In section 8.1, we studied how to implement the __init__ method in a custom class. If the subclass has the same implementation as the superclass, you don’t need to override __init__ at all. But if you need customized initialization, as in the case of Supervisor, you want to override __init__. How can you override __init__ in the Supervisor class?

Hint Overriding __init__ isn’t different from overriding other methods. You use super() to create a proxy object to use the constructor of the superclass.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.